package com.lbm.business.service.impl;

import java.util.List;

import com.lbm.baseclass.exception.ServiceException;
import com.lbm.baseclass.service.impl.BaseServiceImpl;
import com.lbm.business.service.IRoleUserService;
import com.lbm.model.RoleUser;

public class RoleUserServiceImpl  extends BaseServiceImpl implements IRoleUserService{
	/**
	 * 通过HQL构造查询条件来查询符合条件的UserUser信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getRoleUserByHQL(String hql) throws ServiceException {
		return baseDAO.getValueObjectsByHQL(hql);
	}
	/**
	 * 根据主键查询UserUser信息明细
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public RoleUser getRoleUserById(String id) throws ServiceException {
		RoleUser roleUser=null;
		List list=baseDAO.getValueObjectsByHQL(" from RoleUser where roleid='"+id+"'");
		if(!list.isEmpty()&&list.size()>0){
			roleUser=(RoleUser)list.get(0);
		}
		return roleUser;
	}
	/**
	 * 查询所有的UserUser信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getAllRoleUser() throws ServiceException {
		return baseDAO.getValueObjectsByHQL(" from RoleUser");
	}
	/**
	 * 新增、修改UserUser信息
	 * 
	 * @param UserUser
	 * @throws DataAccessException
	 */
	@Override
	public void saveOrUpdateRoleUser(RoleUser roleUser) throws ServiceException {
		baseDAO.saveOrUpdateVO(roleUser);
	}
	/**
	 * 删除UserUser信息
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public void deleteRoleUser(String id) throws ServiceException {
		RoleUser userUser=this.getRoleUserById(id);
		baseDAO.deleteVO(userUser);
	}
}
